<?php

class Pipes_Controller_PageType_Html
{
    private $_config = null;
    private $_caller = null;
    private $_default_title = 'Pipes Framework';
    
    public function __construct(PipesImpl_Config $config, PipesImpl_Controller $controller) {
        $this->_caller = $controller;
        $this->_config = $config;
        
        $parser = new Pipes_Namespace_Parser();
        $this->_namespace = $parser->parse("{$config->namespace}:Html");
    }
    
    public function render(PipesImpl_View_Result $result) {
        $view = new Pipes_View($this->_config, 'PageTypes/Html');
        $view->controller_content = $result;
        $view->title = isset($this->_caller->title) ? $this->_caller->title : $this->_default_title;
        $view->base_uri = $this->_config->base_uri;
        return $view->render('default');
    }
}
